﻿using National.Bll.Service;
using National.Model;
using National.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace National.Controllers
{
    public class LoginController : Controller
    {
        public JsonResult LoginInfo(bool DC, User user)
        {
            Operate op = new Operate();
            Member A = new Member();
            op.Success = A.Login(user);
            if (op.Success)
            {
                Users.ent.admin02 = user;
                if (DC)
                {
                    HttpCookie h = new HttpCookie("Admin");
                    //设置过期时间
                    //赋值
                    h.Values.Add("name", user.UserName);
                    h.Values.Add("pwd", user.Pwd);
                    ////将cookie保存在上下文
                    System.Web.HttpContext.Current.Response.Cookies.Add(h);
                }
            }
            return Json(op);
        }
    }
}